package info.brenstar.boxedin;

import info.brenstar.boxedin.collisions.CollisionMap;
import info.brenstar.boxedin.core.*;
import info.brenstar.boxedin.rooms.TestRoom;
import info.brenstar.boxedin.sprites.Platform;
import info.brenstar.boxedin.sprites.Player;

import org.newdawn.slick.*;

public class Program implements Game {
	
	private static final String NAME = "Boxed In";
	private Room currentRoom;
	
	public Program() {
		TestRoom room = new TestRoom();
		currentRoom = room;
	}
	
	@Override
	public void init(GameContainer gc) throws SlickException {
		currentRoom.init();
	}
	
	@Override
	public void update(GameContainer container, int delta) throws SlickException {
		Input i = container.getInput();
		if (i.isKeyDown(Input.KEY_F4)) { currentRoom = new TestRoom(); currentRoom.init(); System.out.close(); }
		currentRoom.update(container, delta);
	}
	
	@Override
	public void render(GameContainer container, Graphics g) throws SlickException {
		currentRoom.render(container, g);
	}
	
	@Override
	public boolean closeRequested() {
		return true;
	}
	
	@Override
	public String getTitle() {
		return Program.NAME;
	}
	
	
	public static void main(String[] args) throws SlickException {
		AppGameContainer app = new AppGameContainer(new Program());
		
		//app.setShowFPS(false);
		app.setTargetFrameRate(60);
		app.setDisplayMode(800, 640, false);
		app.start();
	}

	
	
}
